Skip to content

fix(quota): lead saved context responses with the returned page - #8284

Merged
loopx-agent merged 1 commit into
mainfrom
codex/saved-context-page-first-20261107
Nov 7, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/saved-context-page-first-20261107

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Goal and delivered outcome

quota context-project --initial-read returns the first selected page and navigation together. The attached navigation previously led with the offset-zero first-read command. A caller following that direction could restart a selection whose first page was already available.

The combined response now puts the page and its actual continuation before attached navigation. The attached guidance directs callers to the returned content and to next_command when another page exists. first_read_command provides recovery for missing initial context. The default reference-only response still uses that command as its initial entry point.

Author declaration

Written by OpenAI Codex as a model agent.

Implemented against the saved-preflight and same-capture reading contract in Required work context.

Criterion Disposition Evidence
Use the bounded page returned by a saved preflight Implemented The saved projection CLI returns content first and the fixture follows its exact cursor through EOF.
Recover the original selection and preserve the original receipt Implemented The offset-zero recipe reconstructs the same bytes. A budget refusal retains the receipt and original capture digest, with a separately verified current recovery view.
Preserve the ordinary native navigation entry point and explicit off behavior Implemented Reference-only, off and rejected-selection cases traverse the real CLI in isolated fixtures.

Scope and continuation

The shared CLI presenter owns the change. It uses the existing reader, page budget, schema, and capture bindings. The adjacent refactoring pass found that the combined response and reference-only guidance can share the existing presenter with one explicit composition flag. A caller that forwards only the nested navigation still needs recovery. This change qualifies the response and recovery affordance. Model adoption and aggregate cost remain unmeasured.

Validation

Tested head 7ce7a28a74ef3e20b9f0eb34fb6a332a5d3c02de. Intended PR base main, verified at 172d80d630f424b0b44dd513863ba02b5f13d55c. Input class is synthetic.

Check kind Result Evidence
Regression parity Passed The new EOF and multipage assertions reproduced the old navigation-first ordering on the verified base. The candidate passed both cases and the existing compaction replay case.
Real entry point Passed The new fixture covers reference-only and combined reads, explicit selectors, missing selectors, byte limits, exact continuation and offset-zero replay. It verifies original capture and journal preservation.
Packaged CLI Passed An isolated wheel emitted a 6,399-byte combined response under a 6,400-byte limit. Its own commands reconstructed the same 22,561-byte selection by continuation and recovery. The too-small budget preserved source recovery.
Broader source suite 161 passed, 2 failed, 11 skipped Saved projection, context delivery and saved replan modules. The two File and SQLite warm-delta failures reproduce on the unchanged base, which returns a full view in both cases. Skips are opt-in native host tests.
Static and premerge Passed Changed-file Ruff and diff checks passed. Standard diff-selected premerge passed six direct and 19 selected checks, including the public boundary scan.

The checkout and package checks used local synthetic input. Live model-host tests and remote CI remain separate.

UI impact is none. The change concerns the existing CLI JSON response.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent, gpt-6.1-sol, OpenAI, runtime_reported, max

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

动机 / Motivation

执行已保存的工作决策时,Agent 通过 CLI 获取第一段工作上下文。 旧输出先展示导航,读者容易按首读命令再次从零开始。新输出先展示已返回的内容,后面紧跟实际可用的续页命令。 同一选区可以从返回的游标读到末尾,也可以用同一捕获的首读命令恢复。 此次验收以 CLI 的呈现与恢复为边界。实际模型采用、外层截断和总成本需要各自的验证。

改动思路 / Approach

结果已经经过原有读取器的预算计算,现有导航呈现层足以表达随页返回和单独返回引用的区别。 当前交付限定在保存上下文的组合输出和导航文案。选择、校验、回执和续页仍由现有入口承担。 单独挪动导航会留下旧的起读提示,单独改文案则保留旧的输出位置。合在现有呈现器内处理,普通引用依旧给出入口,随页返回时则按实际页和游标指路。读取器把页面和附着导航一起计入预算。外层呈现随后调整字段位置。

具体改动 / Changes

审阅依据是 docs/reference/required-work-context.md 在 172d80d630f424b0b44dd513863ba02b5f13d55c 的保存 preflight 契约。saved-page 由有界首段和实际续页覆盖。same-capture-recovery 由原捕获重放验证。reference-entry 通过基线和候选的普通引用指令对照。read-authority 由错误摘要、身份和关闭路径拒绝以及原回执读回覆盖。规范原文

关键代码讲解

  • project_saved_context_capture 先校验文件摘要和 Goal、Agent、Turn,再从现有选项判断是否为原生组合读取。引用模式不携带组合提示。入口
  • _native_context_reference 在同一预算中区分组合页与单独引用。组合页的首读命令用于同一捕获恢复。旧基线限定和使用前读完整附件的条件保留。导航
  • _saved_context_read_page 调用同一读取器,成功页把已计入预算的导航移到末尾。实际 EOF 和下一命令来自原有 _capture_page。无效指针仍返回原捕获的恢复路线。组合 分页

双语说明给出首段、续页、丢失首段及其他字段的读取路线。新增测试覆盖 EOF 和多页、原捕获回放、显式字段、错误指针与过小预算。说明 用例

对主干的风险 / Risks

独立 CLI 对照中,6,400 字节预算下首段内容从 2,244 变为 2,184 字节,完整选区仍为 31,778 字节,摘要相同。安装 wheel 的首包为 6,400 字节,沿真实游标及恢复入口均重建相同的 22,561 字节。256 字节拒绝保留原回执、原捕获身份和可核验的恢复文件。外层工具预算更紧时,转发仍可能截断结果。

验证 结果
checkout CLI 正反例、相同选区重放、禁用和引用路径对照 PASS
安装 console、实际续页命令、失败后恢复 PASS
标准 diff canary、RFC 双语检查和公开边界 PASS
File、SQLite 热读绑定各一例 FAIL。基线与本提交都在同一断言得到 full,用例预期 delta。压缩后两条用例通过。
真实模型宿主及外层转发行为 UNVERIFIED。广测的 11 项 opt-in 宿主场景跳过。远端 CI 按本次配置未查询。

语义与 CI 对齐

复用既有捕获页、选区和回执协议。局部 page_attached 由当前参数派生。关闭模式、普通引用、错误输入的基线和候选对照一致,真正变化的组合首段及同捕获续读由源 CLI 和安装验证独立覆盖。主干推进到 f301bfc4ea 涉及 Research 工作区,未改动这些调用路径。

我的整体评价 / Verdict

本次范围的首段阅读与恢复交付成立。长期续作的证据是同一选区、回执和压缩后重放仍可用。调用者看见已返回的内容和真实续页,少了一处可能引导重复阅读的指令。已检查受影响的 CLI JSON、文档及调用方,本次变化没有独立的网页或原生视图。 真实模型采用、外层转发和总成本仍待测。两条基线热读失败保留原判,合并资格另行核对。

English verdict: APPROVE 7ce7a28. The installed CLI prioritizes the existing page and cursor, preserves same-capture replay, and passes the focused and standard local checks. Two warm-delta failures reproduce on the base.

@loopx-agent
loopx-agent merged commit 3216751 into main Nov 7, 2026
12 of 35 checks passed
@loopx-agent
loopx-agent deleted the codex/saved-context-page-first-20261107 branch November 7, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant